Skip to content

fix: add metadata to module pages#374

Open
rohit-Jung wants to merge 2 commits into
apsinghdev:mainfrom
rohit-Jung:fix/module-metadata
Open

fix: add metadata to module pages#374
rohit-Jung wants to merge 2 commits into
apsinghdev:mainfrom
rohit-Jung:fix/module-metadata

Conversation

@rohit-Jung
Copy link
Copy Markdown

@rohit-Jung rohit-Jung commented May 5, 2026

Fixes: #373

Correctly shows the module info title and description

image

Summary by CodeRabbit

Release Notes

  • New Features
    • Sheet pages now dynamically generate metadata with formatted titles and descriptions based on sheet modules
    • Added a new utility function for string capitalization

@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

@rohit-Jung is attempting to deploy a commit to the AJEET PRATAP SINGH's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

Warning

Rate limit exceeded

@rohit-Jung has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 42 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 75e710d1-8fef-41a4-91d2-051c6f90d323

📥 Commits

Reviewing files that changed from the base of the PR and between b8215b3 and 51c2f72.

📒 Files selected for processing (1)
  • apps/web/src/lib/utils.ts
📝 Walkthrough

Walkthrough

Added dynamic page title metadata generation for sheet modules. A new capitalizeFirstLetter utility function formats module names, imported into the sheet page to generate title and description metadata fields for the browser tab and search engines.

Changes

Sheet Module Title Metadata

Layer / File(s) Summary
Utility Function
apps/web/src/lib/utils.ts
New capitalizeFirstLetter(word: string) function returns the input string with the first character uppercased.
Metadata Generation
apps/web/src/app/(main)/sheet/[moduleId]/page.tsx
Added generateMetadata export that resolves the moduleId, looks up the matching sheet module, and returns dynamic title and description using the capitalized module name. Includes new imports for Metadata and capitalizeFirstLetter.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A rabbit hops through sheets with glee,
Module names now clear for all to see!
No more "Opensox" on every page,
Each tab's identity takes center stage.
Capitalization spells the day—
The perfect fix in every way! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: add metadata to module pages' directly describes the main change: adding metadata to module pages to fix the issue where tabs were indistinguishable.
Linked Issues check ✅ Passed The PR implements the required solution for issue #373 by adding generateMetadata export that returns dynamic title and description using module information, enabling distinguishable page headers.
Out of Scope Changes check ✅ Passed All changes are directly scoped to resolving issue #373: adding metadata generation for module pages and the supporting utility function for text capitalization.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/web/src/lib/utils.ts (1)

8-10: ⚡ Quick win

use a const arrow function for this utility

Please align this helper with the repo convention for function declarations in apps/web/src/**.

proposed change
-export function capitalizeFirstLetter(word: string) {
-  return word.charAt(0).toUpperCase() + word.slice(1);
-}
+export const capitalizeFirstLetter = (word: string): string => {
+  return word.charAt(0).toUpperCase() + word.slice(1)
+}

As per coding guidelines, "Use const with arrow functions instead of function declarations (e.g., 'const toggle = () =>')".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/lib/utils.ts` around lines 8 - 10, The utility uses a function
declaration; change it to the repo convention by exporting a const arrow
function instead: replace the function declaration for capitalizeFirstLetter
with an exported const named capitalizeFirstLetter assigned to an arrow function
(keeping the same parameter name and return expression) so behavior is unchanged
and style aligns with other utils.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/web/src/app/`(main)/sheet/[moduleId]/page.tsx:
- Line 23: The description string uses sheetModule?.name.toLowerCase() which can
throw if name is undefined; update the template to safely access and lowercase
the name (e.g., use sheetModule?.name?.toLowerCase() or provide a fallback like
|| ""), mirroring the title's fallback so description becomes `This module
describes how to ${sheetModule?.name?.toLowerCase() || ""}` (or equivalent) to
avoid runtime errors in metadata generation.

---

Nitpick comments:
In `@apps/web/src/lib/utils.ts`:
- Around line 8-10: The utility uses a function declaration; change it to the
repo convention by exporting a const arrow function instead: replace the
function declaration for capitalizeFirstLetter with an exported const named
capitalizeFirstLetter assigned to an arrow function (keeping the same parameter
name and return expression) so behavior is unchanged and style aligns with other
utils.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b7fae0fd-e063-4d0b-980a-051e352ddbee

📥 Commits

Reviewing files that changed from the base of the PR and between 33dcff0 and b8215b3.

📒 Files selected for processing (2)
  • apps/web/src/app/(main)/sheet/[moduleId]/page.tsx
  • apps/web/src/lib/utils.ts


return {
title: `${capitalizeFirstLetter(sheetModule?.id || "Modules")}: ${sheetModule?.name || ""} `,
description: `This module describes how to ${sheetModule?.name.toLowerCase()}`,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify potentially unsafe optional-chaining method calls in this file.
rg -nP 'sheetModule\?\.[A-Za-z0-9_]+\.[A-Za-z0-9_]+\(' apps/web/src/app/(main)/sheet/[moduleId]/page.tsx

Repository: apsinghdev/opensox

Length of output: 254


🏁 Script executed:

cat -n apps/web/src/app/\(main\)/sheet/\[moduleId\]/page.tsx | head -40

Repository: apsinghdev/opensox

Length of output: 1651


unsafe optional chaining in metadata generation can throw

Line 23 calls .toLowerCase() without continuing the optional chain. If sheetModule.name is undefined, this throws at runtime. The title on line 22 correctly uses a fallback (|| ""), but description does not.

proposed fix
-    description: `This module describes how to ${sheetModule?.name.toLowerCase()}`,
+    description: `This module describes how to ${sheetModule?.name?.toLowerCase() ?? "learn this topic"}`,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/app/`(main)/sheet/[moduleId]/page.tsx at line 23, The
description string uses sheetModule?.name.toLowerCase() which can throw if name
is undefined; update the template to safely access and lowercase the name (e.g.,
use sheetModule?.name?.toLowerCase() or provide a fallback like || ""),
mirroring the title's fallback so description becomes `This module describes how
to ${sheetModule?.name?.toLowerCase() || ""}` (or equivalent) to avoid runtime
errors in metadata generation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GENERAL] Not able to see the module info on sheet header/title

1 participant